import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import { RouterProvider } from 'react-router-dom'
import './index.css'
import './styles/global.css'
import { router } from './routes'
import AppProvider from './components/AppProvider'

// 引入国际化配置
import './utils/i18n'

// 启动Mock服务（仅在开发环境且配置启用时）
  if (import.meta.env.DEV && import.meta.env.VITE_USE_MOCK === 'true') {
    import('./mock').then(({ startMock }) => {
      startMock();
    }).catch(error => {
      console.error('加载Mock服务失败:', error);
    });
  }

createRoot(document.getElementById('root')!).render(
  <StrictMode>
    <AppProvider>
      <RouterProvider router={router} />
    </AppProvider>
  </StrictMode>,
)
